<!DOCTYPE html>

<html >
<head >
	<title>后台登录</title>

	<script type="text/javascript">
		function checkUserInfo() {
			var name = document.getElementById("adminUserName").value;
			var password = document.getElementById("adminPassword").value;
			if (name != "admin" || password != "123456") {
				alert("登录名或者密码错误");
				return;
			}
			// alert("登录成功");

			var xmlhttp;

			if (window.XMLHttpRequest) {
				xmlhttp = new XMLHttpRequest();
			} else {
				xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
			}

			xmlhttp.onreadystatechange = function() {
				if (xmlhttp.readyState == 4) {

					var ret = xmlhttp.responseText;
					// 成功回调
					// alert(ret);
					self.location = "index.php";
				}
			}
			xmlhttp.open("GET", "loginaction.php?username=" + name + "&password=" + password, true);
			xmlhttp.send();
		}
	</script>
</head>

<body>

<div>
	<h2>后台登录页面</h2>
</div>

<div>
	<form method="POST" action="">
		用户名:<input type="text" name="username" id="adminUserName">
		<br>
		密码:<input type="password" name="password" id="adminPassword">
		<br>
		<input type="submit" name="submit" value="提交" onclick="checkUserInfo()">
	</form>
</div> 

</body>
</html>